package com.yb.xczx.security.resource.annotation;

import com.yb.core.web.annotation.EnableWebCore;
import com.yb.xczx.security.resource.config.OAuth2JwtTokenConfig;
import org.springframework.context.annotation.Import;
import org.springframework.core.annotation.AliasFor;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;

import java.lang.annotation.*;

/**
 * Copyright (C), 2022-2023, 姚兵
 * Author: 32210
 * Date: 2023/5/22 13:01
 * FileName: EnableXcxzOauth2ResourceSecurity
 * Description:
 */
@Target(value = {ElementType.TYPE,ElementType.ANNOTATION_TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
@EnableWebCore
@EnableWebSecurity
@LoginRequired
@EnableGlobalMethodSecurity(prePostEnabled = true,securedEnabled = true)
@Import({OAuth2JwtTokenConfig.class})
public @interface EnableXcxzJwtOauth2ResourceSecurity {
    boolean jwtEnable() default false;

    @AliasFor(annotation = LoginRequired.class,attribute = "needLogin")
    boolean needLogin() default false;//是否需要登陆，resource server不需要登陆，authorization server需要登陆
}
